package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:char(11);not null"`
	Password string `gorm:"type:char(32);not null"`
	UserName string `gorm:"type:varchar(30);not null"`
	Image    string `gorm:"type:varchar(500);not null"`
}
type Commodity struct {
	gorm.Model
	Title   string  `gorm:"type:varchar(30);not null"`
	Class   string  `gorm:"type:varchar(30);not null"`
	Price   float64 `gorm:"type:decimal(10,2);not null"`
	Details string  `gorm:"type:varchar(100);not null"`
	UserId  int     `gorm:"type:int(11);not null"`
}
type Comment struct { //评论
	gorm.Model
	Content     string `gorm:"type:varchar(100);not null"`
	UserId      int    `gorm:"type:int(11);not null"`
	CommodityId int    `gorm:"type:int(11);not null"`
}
type Collect struct { //收藏
	gorm.Model
	UserId      int `gorm:"type:int(11);not null"`
	CommodityId int `gorm:"type:int(11);not null"`
}
type CommodityData struct {
	Commodity
	UserName string
	Image    string
}
type CommentData struct {
	Content string
	Commodity
}